package com.nova.auth.controller;

import com.nova.auth.service.impl.UserServiceImpl;
import com.nova.base.response.PageResponse;
import com.nova.base.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ttao
 * @since 2024/9/28 23:35
 */
@RestController
public class AuthController {

    @Autowired
    private UserServiceImpl userService;

    @PostMapping("/auth")
    public PageResponse<String> load(@Validated @RequestBody User user) {

        List<String> list = new ArrayList<>();
        return PageResponse.of(list, 1, 1, 1);
    }

    @PostMapping("/auth/add")
    public Response<Void> save(@Validated @RequestBody User user) {
        userService.save(user);
        return Response.of();
    }
}
